@include('admin.header')
<style>
  .search_product {
    max-height:248px;
    overflow-y: scroll;
  }
  .search_product > .item {
    width:80px;
    margin-right:5px;
    float:left;
  }
  .search_product > .item img {
    height:80px;
  }
  .search_product > .item .name {
    height:20px;
    overflow:hidden;
  }

  .order_info {
    display: block;
    margin-top: 5px;
  }

  .line {
    border: 3px dashed #ccc;
    margin-top: 10px;
    margin-bottom: 20px;
  }
</style>
<div class="margin-top-20">
  <form method="post" class="form-horizontal js-ajax-form direct_order_edit_form" action="/globalexchange/direct_order_edit" novalidate="novalidate" enctype ="multipart/form-data">
    <fieldset>
    @foreach($data as $val)
      <!-- 订单号 -->
      <div class="control-group"><label class="control-label">订单号</label>
        <div class="controls">
          <span class="order_info">{{$val->order_no}}</span>
        </div>
      </div>
      <!-- 套餐ID号 -->
      <div class="control-group"><label class="control-label">套餐ID号</label>
        <div class="controls">
          <span class="order_info">{{$val->id}}</span>
        </div>
      </div>
      <!-- 套餐名称 -->
      <div class="control-group"><label class="control-label">套餐名称</label>
        <div class="controls">
          <span class="order_info">{{$val->cost_name}}</span>
        </div>
      </div>
      <!-- 用户ID号 -->
      <div class="control-group"><label class="control-label">用户ID号</label>
        <div class="controls">
          <span class="order_info">{{$val->node_id}}</span>
        </div>
      </div>
      <!-- 用户姓名 -->
      <div class="control-group"><label class="control-label">用户姓名</label>
        <div class="controls">
          <span class="order_info">{{$nodename}}</span>
        </div>
      </div>
      <!-- 套餐金额 -->
      <div class="control-group"><label class="control-label">套餐金额</label>
        <div class="controls">
          <span class="order_info">{{$val->amount}}元</span>
        </div>
      </div>
      <!-- 支付状态 -->
      <div class="control-group"><label class="control-label">支付状态</label>
        <div class="controls">
          <span class="order_info">
            @if($val->pay_status == 0)
              未支付
            @elseif($val->pay_status == 1)
              已支付
            @endif
          </span>
        </div>
      </div>
      <!-- 支付详情 -->
      <div class="control-group"><label class="control-label">支付详情</label>
        @foreach($val->pay_detail as $pay)
        <div class="controls">
          <span class="order_info">
            {{$pay['Remarks']}}::{{$pay['PayAmount']}}
          </span>
        </div>
        @endforeach
      </div>
      <!-- 支付金额 -->
      <div class="control-group"><label class="control-label">支付金额</label>
        <div class="controls">
          <span class="order_info">{{$val->pay_amount}}元</span>
        </div>
      </div>
      <!-- 订单PV -->
      <div class="control-group"><label class="control-label">订单PV</label>
        <div class="controls">
          <span class="order_info">{{$val->cost_pv}}</span>
        </div>
      </div>
      <!-- 下单时间 -->
      <div class="control-group"><label class="control-label">下单时间</label>
        <div class="controls">
          <span class="order_info">{{$val->create_time}}</span>
        </div>
      </div>

      <!-- 分割线 -->
      <div class="line"></div>
      @endforeach
    </fieldset>
  </form>
</div>

<script>
  $(function () {
    $('.direct_order_edit_form').submit(function(){
      var $t = $(this),action=$t.attr('action'),data = $t.serialize();
      post(action,data,function(data){
        _alert('处理成功',function(){
          parent.location.reload();
          parent.layer.close(parent.layer_open2);
        });
      });
      return false;
    });
  });
  
  function product_add(product_id){
    var $t = $('[name=product_id]'),val = $t.val(),vals = val.split(',');
    product_id = product_id + '';
    if(vals.length == 1){
      if(vals[0] == '')
        vals = [];
        }
    if($.inArray(product_id,vals) === -1){
      vals.push(product_id);
      val = vals.join(',');
        }
    $t.val(val);
    }
</script>